<!DOCTYPE html>
<html lang="zh"  xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <title>后台首页 - 后台管理系统</title>
  <link href="/bbs/static/admin/css/bootstrap.min.css" rel="stylesheet">
  <link href="/bbs/static/admin/css/materialdesignicons.min.css" rel="stylesheet">
  <link href="/bbs/static/admin/css/style.min.css" rel="stylesheet">
<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--头部信息-->
    <div th:insert="~{admin/aside :: header1}"></div>
    <!--End 头部信息-->

    <!--左侧导航-->
    <div th:insert="~{admin/aside :: aside}"></div>
    <!--End 左侧导航-->

    <!--页面主要内容-->
    <main class="lyear-layout-content">
      <div class="container-fluid">

        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-toolbar clearfix">
                <div class="toolbar-btn-action">
                  <form th:action="@{/admin/getTitles}" class="pull-left form-inline" method="get"  role="form">
                    <div class="input-group">
                      <input type="text" class="form-control" value="" name="content" placeholder="请输入内容关键字">
                    </div>
                    <div class="input-group">
                      <input type="submit" class="form-control">
                    </div>
                  </form>

                </div>
              </div>

              <div class="card-body">

                <div class="table-responsive">
                  <table class="table table-bordered" style="table-layout: fixed;">
                    <thead>
                    <tr>
                      <th width="10%">编号</th>
                      <th>标题</th>
                      <th>内容</th>
                      <th>作者</th>
                      <th>发布时间</th>
                      <th>查看回帖</th>
                      <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="t:${titlePageInfo.list}">
                      <td th:text="${t.id}"></td>
                      <td th:text="${t.title}"></td>
                      <td th:text="${t.content}" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"></td>
                      <td th:text="${t.user.name}"></td>
                      <td th:text="${t.uptime}"></td>
                      <td><a class="btn btn-success" th:href="@{'/admin/getReplies?title_id='+${t.id}}">查看回帖</a></td>
                      <td>
                        <div class="btn-group" >
                          <a class="btn btn-xs btn-default"  title="编辑" data-toggle="tooltip" th:href="@{'/admin/GoToEditTitle?id='+${t.id}+'&pageNo='+${titlePageInfo.pageNum}}"><i class="mdi mdi-pencil"></i></a>
                          <a class="btn btn-xs btn-default"  title="删除" data-toggle="tooltip" th:href="@{'/admin/deleteTitle?id='+${t.id}+'&pageNo='+${titlePageInfo.pageNum}}"><i class="mdi mdi-window-close"></i></a>
                        </div>
                      </td>
                    </tr>
                    </tbody>
                  </table>
                </div>
                <ul class="pagination" th:with="key='&title='+${title1.title}+'&content='+${title1.content}+'&kind_id='+${title1.kind_id}">
                  <li><a th:href="@{'/admin/getTitles?pageNo=1'+${key}}"><span>首页</span></a></li>

                  <li><a th:href="@{'/admin/getTitles?pageNo='+${titlePageInfo.prePage}+${key}}"><span>«</span></a></li>

                  <li th:each="i:${titlePageInfo.navigatepageNums}" th:class="${titlePageInfo.pageNum==i}?'active': '' ">
                    <a th:href="@{'/admin/getTitles?pageNo='+${i}+${key}}" th:text="${i}"></a>
                  </li>

                  <li><a th:href="@{'/admin/getTitles?pageNo='+${titlePageInfo.nextPage}+${key}}"><span>»</span></a></li>
                  <li><a th:href="@{'/admin/getTitles?pageNo='+${titlePageInfo.pages}+${key}}"><span>尾页</span></a></li>

                </ul>

              </div>
            </div>
          </div>

        </div>

      </div>
    </main>
    <!--End 页面主要内容-->
  </div>
</div>
<script type="text/javascript" src="/bbs/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/bbs/static/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/bbs/static/admin/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/bbs/static/admin/js/main.min.js"></script>
<script src="/bbs/static/admin/js/lightyear.js"></script>
<script th:inline="javascript">
  var kindid=[[${title1.kind_id}]];
  $.ajax({
    url:"/bbs/admin/getKind",
    type:'get',
    success:getkind
  });
  function getkind(data){
    for(var i in data){
      if(data[i].id===kindid)
        $("#kind").append("<option selected value='"+data[i].id+"'>"+data[i].name+"</option>")
      else
        $("#kind").append("<option value='"+data[i].id+"'>"+data[i].name+"</option>")
    }
  }
  function change(kindid){
    window.location.href="getTitles?kind_id="+kindid;
  }
</script>
</body>
</html>